using MicroMsg.Common.Utils;
using MicroMsg.Manager;
using MicroMsg.UI.Util;
using Microsoft.Phone.Shell;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.UserContrl
{
	public class SnsWelcomeCtrl : UserControl
	{
		private const string TAG = "SnsWelcomeCtrl";
		private bool mBIsFirstLoaded = true;
		private static IApplicationBar sBar;
		public static bool sBIsShown = false;
		internal Grid LayoutRoot;
		internal Button btnClose;
		internal Button btnIKnow;
		private bool _contentLoaded;
		private SnsWelcomeCtrl()
		{
			this.InitializeComponent();
			base.add_Loaded(new RoutedEventHandler(this.Control_Loaded));
			base.add_Unloaded(new RoutedEventHandler(this.Control_Unloaded));
		}
		private void Control_Loaded(object sender, RoutedEventArgs e)
		{
			Log.smethod_5("SnsWelcomeCtrl", "Control_Loaded");
		}
		private void Control_Unloaded(object sender, RoutedEventArgs e)
		{
			Log.smethod_5("SnsWelcomeCtrl", "Control_Unloaded");
		}
		private void btnClose_Click(object sender, RoutedEventArgs e)
		{
			this.Hide(1);
		}
		private void btnIKnow_Click(object sender, RoutedEventArgs e)
		{
			this.Hide(3);
		}
		public static void Show(Panel panel)
		{
			if (panel == null)
			{
				return;
			}
			BasePage rootPage = ToolFunction.GetRootPage();
			if (rootPage == null)
			{
				return;
			}
			SnsWelcomeCtrl.sBar = rootPage.get_ApplicationBar();
			if (SnsWelcomeCtrl.sBar != null)
			{
				SnsWelcomeCtrl.sBar.set_IsVisible(false);
			}
			panel.get_Children().Add(new SnsWelcomeCtrl());
			SnsWelcomeCtrl.sBIsShown = true;
		}
		private void Hide(int nAddCnt = 1)
		{
			int @int = ConfigMgr.getInt("strKeyNInCircleCnt", 0);
			ConfigMgr.setInt("strKeyNInCircleCnt", @int + nAddCnt);
			if (base.get_Parent() != null)
			{
				Panel panel = base.get_Parent() as Panel;
				if (panel != null)
				{
					panel.get_Children().Remove(this);
				}
			}
			if (SnsWelcomeCtrl.sBar != null)
			{
				SnsWelcomeCtrl.sBar.set_IsVisible(true);
			}
			SnsWelcomeCtrl.sBIsShown = false;
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/Plugin/Sns/Circle/UI/SnsWelcomeCtrl.xaml", 2));
			this.LayoutRoot = (Grid)base.FindName("LayoutRoot");
			this.btnClose = (Button)base.FindName("btnClose");
			this.btnIKnow = (Button)base.FindName("btnIKnow");
		}
	}
}
